/**
 * 详情页面的js
 */

function submitLogin() {
    var email = $('#email').val();
    if (email=='' || email==null) {
        $('#email').next('span').text('请填写邮箱地址！');
        return false;
    } else {
        var reg=/^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/gi;
        if(!reg.test(email)) {
            $('#email').next('span').text('请填写正确的邮箱格式！');
            return false;
        }
    }
    var pwd = $('#password').val();
    if (pwd=='' || pwd==null) {
        $('#password').next('span').text('请填写登录密码！');
        return false;
    }
    return true;
}
$(function() {
    $('#userLoginForm').on('submit', function(){
        return submitLogin();
    });
    $('#email').on('focus', function(){
        $(this).next('span').text('');
    });
    
    $('#password').on('focus', function(){
        $('#password').next('span').text('');
    });
});
